import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86183
 */
public class Test2 {
    //计算1~5的和
    public static int sum(int n){
        if(n == 1){
            return 1;
        }
        return n + sum(n -1);
    }
    public static void main4(String[] args) {
        int x = 5;
        System.out.println(sum(x));

    }
    public static int add (int a ,int b){
        return a + b;
    }
  /*  public static double add (int a ,int b){
        return a + b;
    }*/
    public static double add (double a ,double b){
        return a + b;
    }


    public static void main3(String[] args) {
        int x = 10;
        int y = 20;
        int c = add(x,y);
        System.out.println(c);

        double m = 1.0;
        double n = 2.0;
        System.out.println(add(m,n));
    }
    public static void swap(int a, int b){
        int tmp = 0;
        tmp = a;
        a = b ;
        b = tmp;
        System.out.println("a = "+a + " "+ "b = "+ b);
    }
    public static void main2(String[] args) {
        int x = 10;
        int y = 20;
        swap(x, y);
        System.out.println("x = "+ x+ " "+ "y = "+ y);
    }
    public static int add1 (int a ,int b){
        System.out.println("add方法被调用了");
        return a + b;

    }
    public static void main1(String[] args) {
        int x = 10;
        int y = 20;
        System.out.println("add方法开始调用");
        int c = add1(x,y);
        System.out.println("add方法调用完");
        System.out.println(c);
    }
}
